Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate the client's file formatting options with JDT code action handlers #1657

Merged
merged 2 commits into from
Feb 24, 2021

Conversation

testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Feb 5, 2021

  • Enable the capability to fetch indentation settings from the client

Signed-off-by: Sheng Chen sheche@microsoft.com

[Jinbo Wang]: Adopt the new compilation unit API to consume the client's formatting options.

  • Using ICompliationUnit.getOptions(true) to replace the old options project.getOptions(true)
  • Fetch the client's formatting options while generating code action proposals

Fixes #1157
Signed-off-by: Jinbo Wang jinbwan@microsoft.com

Based on #1194

@testforstephen
Copy link
Contributor Author

For e2e test, this PR requires redhat-developer/vscode-java#1081 to return the current file's formatting options.

jdneo and others added 2 commits February 22, 2021 14:00
Signed-off-by: Sheng Chen <sheche@microsoft.com>
…andlers

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
Comment on lines +34 to +36
<repository location="https://download.eclipse.org/eclipse/updates/4.19-I-builds/I20210217-1800/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.19M3-I-build contains the dependent formatting changes we made in the upstream jdt.core. But the I-build doesn't contain xtend and xtext sdks, so still need fetch xtend and xtext from the old release. Once 2021-03 release is ready, we can merge these two locations back into one.

Copy link
Contributor

@jdneo jdneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdneo
Copy link
Contributor

jdneo commented Feb 22, 2021

@testforstephen
Copy link
Contributor Author

There will be another PR to remove https://github.com/redhat-developer/vscode-java/blob/master/src/extension.ts#L676 right?

yes, @snjeza has two PRs to handle that parts, see redhat-developer/vscode-java#1631 and #1551. Once this PR is merged, then we can merge the @snjeza's.

@testforstephen testforstephen merged commit babe6d3 into eclipse-jdtls:master Feb 24, 2021
@testforstephen testforstephen deleted the jinbo_formatting branch February 24, 2021 03:30
mfussenegger added a commit to mfussenegger/nvim-jdtls that referenced this pull request Feb 24, 2021
If using a eclipse.jdt.ls version that includes
eclipse-jdtls/eclipse.jdt.ls#1657 this will finally
make code-actions respect the clients shiftwidth/expandtab options and
no longer include tabs when the user uses spaces.

The alternative to overriding the handler would have been to document
that users should include these options in their `config.settings`, but
given that there is no good reason that I can think of where you don't
want to respond with your local editor settings it seems justified to
include this out of the box instead of requiring every user to add this.
mfussenegger added a commit to mfussenegger/nvim-jdtls that referenced this pull request Feb 24, 2021
If using a eclipse.jdt.ls version that includes
eclipse-jdtls/eclipse.jdt.ls#1657 this will finally
make code-actions respect the clients shiftwidth/expandtab options and
no longer include tabs when the user uses spaces.

The alternative to overriding the handler would have been to document
that users should include these options in their `config.settings`, but
given that there is no good reason that I can think of where you don't
want to respond with your local editor settings it seems justified to
include this out of the box instead of requiring every user to add this.
mfussenegger added a commit to mfussenegger/nvim-jdtls that referenced this pull request Feb 24, 2021
If using a eclipse.jdt.ls version that includes
eclipse-jdtls/eclipse.jdt.ls#1657 this will finally
make code-actions respect the clients shiftwidth/expandtab options and
no longer include tabs when the user uses spaces.

The alternative to overriding the handler would have been to document
that users should include these options in their `config.settings`, but
given that there is no good reason that I can think of where you don't
want to respond with your local editor settings it seems justified to
include this out of the box instead of requiring every user to add this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code actions should return textedits with proper formatting
3 participants